import 'package:healthy_station_flutter/generated/json/base/json_convert_content.dart';
import 'package:healthy_station_flutter/entity/drugs_entity.dart';

DrugsEntity $DrugsEntityFromJson(Map<String, dynamic> json) {
  final DrugsEntity drugsEntity = DrugsEntity();
  final String? prescriptionId = jsonConvert.convert<String>(
      json['prescriptionId']);
  if (prescriptionId != null) {
    drugsEntity.prescriptionId = prescriptionId;
  }
  final String? doctor = jsonConvert.convert<String>(json['doctor']);
  if (doctor != null) {
    drugsEntity.doctor = doctor;
  }
  final String? patientId = jsonConvert.convert<String>(json['patientId']);
  if (patientId != null) {
    drugsEntity.patientId = patientId;
  }
  final String? patientName = jsonConvert.convert<String>(json['patientName']);
  if (patientName != null) {
    drugsEntity.patientName = patientName;
  }
  final String? diagnosticName = jsonConvert.convert<String>(
      json['diagnosticName']);
  if (diagnosticName != null) {
    drugsEntity.diagnosticName = diagnosticName;
  }
  final String? subDiagnosticName = jsonConvert.convert<String>(
      json['subDiagnosticName']);
  if (subDiagnosticName != null) {
    drugsEntity.subDiagnosticName = subDiagnosticName;
  }
  final String? medicationOrder = jsonConvert.convert<String>(
      json['medicationOrder']);
  if (medicationOrder != null) {
    drugsEntity.medicationOrder = medicationOrder;
  }
  final String? expires = jsonConvert.convert<String>(json['expires']);
  if (expires != null) {
    drugsEntity.expires = expires;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    drugsEntity.createTime = createTime;
  }
  final String? totalAmount = jsonConvert.convert<String>(json['totalAmount']);
  if (totalAmount != null) {
    drugsEntity.totalAmount = totalAmount;
  }
  final String? strTotalAmount = jsonConvert.convert<String>(
      json['strTotalAmount']);
  if (strTotalAmount != null) {
    drugsEntity.strTotalAmount = strTotalAmount;
  }
  final String? consultId = jsonConvert.convert<String>(json['consultId']);
  if (consultId != null) {
    drugsEntity.consultId = consultId;
  }
  return drugsEntity;
}

Map<String, dynamic> $DrugsEntityToJson(DrugsEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['prescriptionId'] = entity.prescriptionId;
  data['doctor'] = entity.doctor;
  data['patientId'] = entity.patientId;
  data['patientName'] = entity.patientName;
  data['diagnosticName'] = entity.diagnosticName;
  data['subDiagnosticName'] = entity.subDiagnosticName;
  data['medicationOrder'] = entity.medicationOrder;
  data['expires'] = entity.expires;
  data['createTime'] = entity.createTime;
  data['totalAmount'] = entity.totalAmount;
  data['strTotalAmount'] = entity.strTotalAmount;
  data['consultId'] = entity.consultId;
  return data;
}

extension DrugsEntityExtension on DrugsEntity {
  DrugsEntity copyWith({
    String? prescriptionId,
    String? doctor,
    String? patientId,
    String? patientName,
    String? diagnosticName,
    String? subDiagnosticName,
    String? medicationOrder,
    String? expires,
    String? createTime,
    String? totalAmount,
    String? strTotalAmount,
    String? consultId,
  }) {
    return DrugsEntity()
      ..prescriptionId = prescriptionId ?? this.prescriptionId
      ..doctor = doctor ?? this.doctor
      ..patientId = patientId ?? this.patientId
      ..patientName = patientName ?? this.patientName
      ..diagnosticName = diagnosticName ?? this.diagnosticName
      ..subDiagnosticName = subDiagnosticName ?? this.subDiagnosticName
      ..medicationOrder = medicationOrder ?? this.medicationOrder
      ..expires = expires ?? this.expires
      ..createTime = createTime ?? this.createTime
      ..totalAmount = totalAmount ?? this.totalAmount
      ..strTotalAmount = strTotalAmount ?? this.strTotalAmount
      ..consultId = consultId ?? this.consultId;
  }
}